package com.example.mvpdemo.simple5;

import com.example.mvpdemo.simple5.base.BasePresenter_5;

/**
 * p层
 * 特点一：持有M层引用
 * 特点二：持有V层引用
 * 特点三：对M层和V层进行关联
 */
public class WeatherPresenter_5 extends BasePresenter_5<WeatherView_5> {

    private WeatherModel_5 weatherModel;


    public WeatherPresenter_5() {
        this.weatherModel = new WeatherModel_5();

    }


    public void weeather(String cityname) {

        this.weatherModel.weather(cityname, new WeatherModel_5.onResult() {
            @Override
            public void success(String result) {
                if (getView() != null)
                    getView().onWeatherGetSuccess(result);
            }

            @Override
            public void fail(String result) {
                if (getView() != null)
                    getView().onWeatherGetFail(result);
            }
        });
    }

}
